JavaScript Indexed Collections

Visualizing `Array` and `TypedArray` objects.

Array

A global object that holds a list of items. It's a highly flexible, dynamic collection that can grow or shrink and hold elements of different data types (strings, numbers, objects, etc.).

const myFlexibleArray = [1, 'hello', { key: 'value' }];
myFlexibleArray.push(100);

An `Array` is like a dynamic shopping list. You can add any item at any time, and the list automatically adjusts its size.


TypedArray

A family of objects that provide a mechanism for accessing raw binary data. Unlike a regular `Array`, a `TypedArray` is a fixed-length container for elements of a specific numerical data type (e.g., 8-bit integers, 64-bit floats).

const uint8 = new Uint8Array(2);
uint8[0] = 256; // Value will be clamped to 0
uint8[1] = -1;  // Value will be clamped to 255

A `TypedArray` is like a pre-built storage shelf where each slot can only hold a specific type of item and the shelf's size never changes.